home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / hypercrd / xcmds / dvlprstc.hqx / Developer Stack 1.3r / card_6103.txt < prev    next >
Text File  |  1991-04-30  |  3KB  |  144 lines

  1. -- card: 6103 from stack: in.3r
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 2612
  5. -- name: SoundCapToRes
  6.  
  7.  
  8. -- part 2 (button)
  9. -- low flags: 00
  10. -- high flags: A004
  11. -- rect: left=187 top=233 right=283 bottom=270
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 27056 / 27056
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Try It
  20. ----- HyperTalk script -----
  21. on mouseUp
  22.   if the optionkey is down then pass mouseup
  23.  
  24.   put "This lets you convert soundcap or soundwave sounds and install them."
  25.  
  26.   -- get the name of the original sound file
  27.   answer "You may now select the sound file" with "Cancel" or "OK"
  28.   if it = "Cancel" then
  29.     play oops
  30.     hide message window
  31.     exit mouseup
  32.   end if
  33.  
  34.   put filename(FSSD) into SoundName
  35.   if SoundName is empty then
  36.     hide message window
  37.     play oops
  38.     exit mouseup
  39.   end if
  40.   put quote&SoundName"e into SoundName
  41.  
  42.   -- get the sampling rate (between 1 and 4)
  43.   ask "What sample rate should be used? (1,2,3 or 4)" with "2"
  44.   if it <1 or it >4 then
  45.     play oops
  46.     hide message window
  47.     exit mouseup
  48.   end if
  49.  
  50.   if it =1 then put 60 into it else
  51.   if it =2 then put 72 into it else
  52.   if it =3 then put 79 into it else put 84 into it
  53. end if
  54. end if
  55. put it into SampleRate
  56.  
  57. -- let user name the sound resource
  58. ask "What do you want to name this sound?"
  59. if it is empty then
  60.   play oops
  61.   hide message window
  62.   exit mouseup
  63. end if
  64. put it into ResName
  65.  
  66. -- get the name of the destination stack
  67. put "Please select the destination stack"
  68. put filename ("STAK") into Destination
  69. if Destination is empty then
  70.   hide message window
  71.   play oops
  72.   exit mouseup
  73. end if
  74. put quote&Destination"e into Destination
  75.  
  76. -- do the conversion using the XCMD 'SoundCaptoRes'
  77.  
  78. -- SoundCapToRes takes four arguments:
  79. -- the name you want to call the sound
  80. -- the file that contains the SoundCap output (in quotes)
  81. -- the stack in which you want to put the sound
  82. -- the base pitch of the sound (60, 72, 79, or 84)
  83.  
  84. put ResName into Args
  85. put ","&SoundName after Args
  86. put ","&Destination after Args
  87. put ","&SampleRate after Args
  88.  
  89. do "SoundCaptoRes" && Args
  90.  
  91. -- go to the target stack and test the sound
  92. push card
  93. go to Destination
  94. play ResName
  95. repeat while the sound is not "done"
  96. end repeat
  97. pop card
  98. end mouseUp
  99.  
  100.  
  101.  
  102. -- part contents for background part 13
  103. ----- text -----
  104. 3
  105.  
  106. -- part contents for background part 2
  107. ----- text -----
  108. SoundCapToRes
  109.  
  110. -- part contents for background part 3
  111. ----- text -----
  112.  
  113. This will convert a SoundCap or SoundWave file into a 'snd' resource and install it into a specified stack.
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121. Thanks to:
  122. ? (If anyone knows who wrote this please pass the information on so proper credit can be given.)
  123.  
  124.  
  125.  
  126. -- part contents for background part 10
  127. ----- text -----
  128. Syntax:
  129.  
  130. SoundCapToRes <ResourceName>,
  131. <SourceFile>,<DestinationFile>,
  132. <SampleRate>
  133.  
  134.    <ResourceName> is the name of the SND resource to be created.
  135.    <SourceFile> is the path name of the original sound file to be converted.
  136.    <DestinationFile> is the path name of the file to install the SND resource into.
  137.    <SampleRate> is the rate at which the sound should be played.
  138.  
  139.  
  140.  
  141.  
  142. -- part contents for background part 30
  143. ----- text -----
  144. XCMD